using System;
using System.Diagnostics.Contracts;
using Caliburn.Micro;

namespace Boggle.Net.Model
{
    public sealed class AcceptablePlay : PropertyChangedBase
    {
        private readonly SearchResult _searchResult;
        private bool _wasFound;

        public AcceptablePlay(SearchResult searchResult)
        {
            Contract.Requires<ArgumentNullException>(searchResult != null);
            _searchResult = searchResult;
        }

        public bool WasFound
        {
            get { return _wasFound; }

            set
            {
                if (value == WasFound) return;

                _wasFound = value;
                NotifyOfPropertyChange(() => WasFound);
            }
        }

        public int Score
        {
            get { return Game.ScoreLetterCount(Word.Length); }
        }

        public string Word
        {
            get { return _searchResult.Word; }
        }

        public Tray.Location[] Path
        {
            get { return _searchResult.Path; }
        }
    }
}